#!/bin/bash

# step1:build get_address
cd get_address
rm -rf build
mkdir build
cd build
cmake ..
make
./get_address
cd ../../

# step2:set address
txt=`sed -n '1p' address.txt`
sed -i "s/DEFAULT_MAC_ADDRESS/${txt}/g" src/main.cpp

# step3:build calibration_visible
rm -rf build
mkdir build
cd build
cmake ..
make
cd ../

#step4:chmod
cp scripts/autostart.sh /home/pi/
chmod +x /home/pi/autostart.sh
cp scripts/.bashrc /home/pi/
chmod 777 /home/pi/.bashrc

#step5:delete all files
shopt -s extglob
rm -rf !(bin)
rm -rf .git
